home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 183 / dpcs0503.iso / Components / Microsoft ASP / _SETUP.1 / ASPWizard.jar / asp / wizard / util / NfxUtil.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-20  |  4.0 KB  |  89 lines

  1. package asp.wizard.util;
  2.  
  3. import asp.util.EResourceUtil;
  4. import asp.util.ResourceUtil;
  5. import asp.wizard.AspWizardExceptionHandler;
  6. import com.netobjects.nfc.api.ComponentData;
  7. import com.netobjects.nfc.api.ComponentInfo;
  8. import com.netobjects.nfc.api.DNode;
  9. import java.awt.Container;
  10. import java.util.Enumeration;
  11. import java.util.Hashtable;
  12. import java.util.Vector;
  13.  
  14. public class NfxUtil {
  15.    // $FF: synthetic field
  16.    static Class class$asp$wizard$WVPanelIntro;
  17.  
  18.    public static boolean componentsInstalled(DNode theDNode) {
  19.       boolean result = false;
  20.       Boolean doesntExist = new Boolean(false);
  21.       Boolean exists = new Boolean(true);
  22.       Hashtable requiredComponents = new Hashtable();
  23.       requiredComponents.put("asp.nfx.MSDBConnection.MSDBConnection", doesntExist);
  24.       requiredComponents.put("asp.nfx.MSDBQuery.MSDBQuery", doesntExist);
  25.       requiredComponents.put("asp.nfx.MSDBList.MSDBList", doesntExist);
  26.       requiredComponents.put("asp.nfx.MSDBDynaField.MSDBDynaField", doesntExist);
  27.       requiredComponents.put("asp.nfx.MSDBSearch.MSDBSearch", doesntExist);
  28.       requiredComponents.put("asp.nfx.MSDBUpdate.MSDBUpdate", doesntExist);
  29.       requiredComponents.put("asp.nfx.MSDBNav.MSDBNav", doesntExist);
  30.       String compName = null;
  31.       ComponentInfo myCompInfo = new ComponentInfo();
  32.       ComponentData[] installedComps = myCompInfo.getAllComponentsInstalled("asp.nfx");
  33.  
  34.       for(int i = 0; i < installedComps.length; ++i) {
  35.          compName = installedComps[i].getComponentName();
  36.          if (requiredComponents.containsKey(compName)) {
  37.             requiredComponents.put(compName, exists);
  38.          }
  39.       }
  40.  
  41.       Vector missingComponents = new Vector();
  42.       Object compNameStr = null;
  43.       Enumeration e = requiredComponents.keys();
  44.  
  45.       while(e.hasMoreElements()) {
  46.          compNameStr = e.nextElement();
  47.          if (requiredComponents.get(compNameStr) == doesntExist) {
  48.             missingComponents.addElement(compNameStr);
  49.          }
  50.       }
  51.  
  52.       if (missingComponents.size() > 0) {
  53.          ResourceUtil ru = null;
  54.  
  55.          try {
  56.             ru = ResourceUtil.getResourceUtil("asp.wizard.res", class$asp$wizard$WVPanelIntro != null ? class$asp$wizard$WVPanelIntro : (class$asp$wizard$WVPanelIntro = class$("asp.wizard.WVPanelIntro")));
  57.          } catch (EResourceUtil e) {
  58.             System.err.println(((Throwable)e).getMessage());
  59.          }
  60.  
  61.          String msg = ru.getString("err.msg.cantstart_missingcomponent") + " ";
  62.          StringBuffer sb = new StringBuffer(msg);
  63.  
  64.          for(int i = 0; i < missingComponents.size(); ++i) {
  65.             sb.append(missingComponents.elementAt(i).toString());
  66.             if (i < missingComponents.size() - 1) {
  67.                sb.append(", ");
  68.             }
  69.          }
  70.  
  71.          new AspWizardExceptionHandler((Container)null);
  72.          AspWizardExceptionHandler.showMessage(0, sb.toString());
  73.       } else {
  74.          result = true;
  75.       }
  76.  
  77.       return result;
  78.    }
  79.  
  80.    // $FF: synthetic method
  81.    static Class class$(String class$) {
  82.       try {
  83.          return Class.forName(class$);
  84.       } catch (ClassNotFoundException forName) {
  85.          throw new NoClassDefFoundError(((Throwable)forName).getMessage());
  86.       }
  87.    }
  88. }
  89.